package video.background.Utils;

import java.security.SecureRandom;

/**
 * @program: background
 * @description:
 * @author: hlt
 * @create: 2023-08-09 10:36
 **/
public class Random {

    public static String generateString(int length){
        String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        SecureRandom random = new SecureRandom();
        StringBuilder sb = new StringBuilder(length);

        for (int i = 0; i < length; i++) {
            int randomIndex = random.nextInt(characters.length());
            char randomChar = characters.charAt(randomIndex);
            sb.append(randomChar);
        }

        return sb.toString();
    }
}
